/*
 * Copyright (c)$today.year.month.day
 *  admin:郑程荣.
 *  文件名:CustomXAxisRenderer.java
 *  项目功能:
 */

package com.jg.myproject.widget;

/**
 * Created by llz on 2018/11/29.
 */

import android.graphics.Canvas;

import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.renderer.XAxisRenderer;
import com.github.mikephil.charting.utils.MPPointF;
import com.github.mikephil.charting.utils.Transformer;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.ViewPortHandler;
public class CustomXAxisRenderer extends XAxisRenderer {
    public CustomXAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer trans) {
        super(viewPortHandler, xAxis, trans);
    }

    @Override
    protected void drawLabel(Canvas c, String formattedLabel, float x, float y, MPPointF anchor, float angleDegrees) {
        String line[] = formattedLabel.split(" ");
        Utils.drawXAxisValue(c, line[0], x-20, y + mAxisLabelPaint.getTextSize()-1, mAxisLabelPaint, anchor, angleDegrees);
        Utils.drawXAxisValue(c, line[1], x, y, mAxisLabelPaint, anchor, angleDegrees);
    }
}
